<?php

use Illuminate\Support\Facades\Route;

use App\Entity\Member;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


use App\Http\Controllers\Service\MemberController;
use App\Http\Controllers\Service\ValidateController;




Route::get('/', function () {
    return redirect('login');
});


Route::get('/register',[\App\Http\Controllers\View\MemberController::class,'toRegister']);
Route::get('/login',[\App\Http\Controllers\View\MemberController::class,'toLogin']);
Route::get('/category',[\App\Http\Controllers\View\BookController::class,'toCategory']);

Route::get('/product/category_id/{category_id}',[\App\Http\Controllers\View\BookController::class,'toProduct']);
Route::get('/product/{product_id}',[\App\Http\Controllers\View\BookController::class,'toPdtContent']);

Route::get('/cart',[\App\Http\Controllers\View\CartController::class,'toCart']);



Route::get('service/validate_code/create', [ValidateController::class,'create']);
Route::post('service/validate_phone/send', [ValidateController::class,'sendSMS']);
Route::post('service/register', [MemberController::class,'register']);
Route::post('service/member/login', [MemberController::class,'login']);


Route::get('service/validate_email',[ValidateController::class,'validate_email']);

Route::get('service/category/parent_id/{parent_id}', [\App\Http\Controllers\Service\BookController::class,'getCategoryByParentId']);
Route::get('service/cart/add/{product_id}', [\App\Http\Controllers\Service\CartController::class, 'addCart']);
Route::get('service/cart/delete', [\App\Http\Controllers\Service\CartController::class, 'deleteCart']);

